<?php

class ScriptAlone_State {

	public $status; // active|stop|restart
	public $pid;
	public $started;
	public $worked;
	public $expire;

	public function __construct($status = 'active', $pid = null, $started = null, $worked = null, $expire = null) {
		$this->status = $status;
		$this->pid = $pid ? $pid : mt_rand() . mt_rand();
		$this->started = $started ? $started : time();
		$this->worked = $worked;
		$this->expire = $expire;
	}

	public function isExpired() {
		return $this->expire && $this->expire < time();
	}
}

